package cn.plushine.service;

import cn.plushine.mapper.BaseInputMapper;
import cn.plushine.pojo.Goods;
import cn.plushine.pojo.POrder;
import cn.plushine.pojo.POrderItem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;


/**
 * 入库订单接口实现类
 */
@Service
public class BaseInputServiceImpl implements BaseInputService {

    @Autowired
    BaseInputMapper baseInputMapper;

    // 获取入库订单
    @Override
    public List<POrder> get() {
        return baseInputMapper.get();
    }

    @Override
    public int update(int warehouse, int area, int position, ArrayList<HashMap> multiplySelect) throws Exception {
        int updateDB = baseInputMapper.update(warehouse, area, position, multiplySelect);
        if (updateDB != 0) {
            return updateDB;
        }
        throw new Exception("批量入库失败！");
    }

    // 修改订单信息（采购订单+仓库订单）
    @Override
    public int modify(String inputId, int keeper) throws Exception {
        int modifyDB = baseInputMapper.modify(inputId, new Date(), keeper);
        if (modifyDB != 0) {
            return modifyDB;
        }
        throw new Exception("修改订单信息（采购订单+仓库订单）失败！");
    }
}
